<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" name="referrer" content="no-referrer">
    <title> </title>
  <link th:href="@{/css/bootstrap.css}" rel="stylesheet">
  <link th:href="@{/css/bootstrap-theme.css}" rel="stylesheet">
  <link th:href="@{/css/index.css}" rel="stylesheet">
  <script src="/js/jquery.min.js"></script>
  <script src="/js/bootstrap.min.js"></script>

</head>
<body>
<!--头部导航栏-->
<nav class="navbar navbar-default" th:fragment="topbar">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">MyHub社区</span>
      </button>
      <a class="navbar-brand" th:href="@{/index}">MyHub社区</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">


      <form class="navbar-form navbar-left" th:action="@{/index}">
        <div class="form-group">

            <input type="text" name="search" class="form-control" placeholder="搜索问题 关键词以空格隔开">

        </div>
        <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
      </form>

      <ul class="nav navbar-nav navbar-right">
        <li th:if="${session.user != null}"><a href="/publish">发布话题</a></li>
        <li th:if="${session.user!=null}"> <a  th:href="@{/profile/message}">我的消息 <span th:if="${session.user.unread}>0" th:text="${session.user.unread}" class="badge"></span></a></li>
        <li th:if="${session.user == null}"><a href="#" data-toggle="modal" data-target="#myModal">登录</a></li>
        <li class="dropdown" th:if="${session.user!=null}">
          <a href="#" class="dropdown-toggle"  type="button" aria-haspopup="true" data-toggle="dropdown" id="dropdown">
            <span  th:text="${session.user.name}"></span>
            <span  class="caret"></span>
          </a>
          <ul class="dropdown-menu" aria-labelledby="dropdown">
            <li><a th:href="@{/profile/questions}">我的问题</a></li>
            <li><a th:href="@{/profile/replies}">我的回复</a></li>
            <li><a th:href="@{/logout}">退出登录</a></li>
          </ul>
        </li>

      </ul>
      <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document" style="margin-top: 200px;width: 300px;">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                      aria-hidden="true">&times;</span></button>
              <h4 class="modal-title" id="myModalLabel">登录注册</h4>
            </div>
            <div class="modal-body" style="text-align:center">
              <a th:href="@{/login/gitee}">
                <img class="icon_login" th:src="@{/images/gitee.png}">
              </a>
              <a th:href="@{/login/baidu}">
                <img class="icon_login_b" th:src="@{/images/baidu.png}">
              </a>
            </div>
            <div class="modal-footer">
              <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
          </div>
        </div>
      </div>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<!--侧边热门话题-->
<div th:fragment="sidebar">
  <h4>热门标签</h4>
  <div>
    <div th:each="hotTag:${hotTags}" class="hotTags">
      <div class=" label label-info tags ">
        <a th:href="@{/index(tag=${hotTag.tagName})}"><span th:text="${hotTag.tagName}"></span></a>
      </div>
    </div>
  </div>
</div>
<!--尾部版权-->
<div th:fragment="foot" class="footer">
<!--  <div>Copyright © 2021  ICP备000000号 · 服务器赞助: <a href="https://www.ucloud.cn/">UCloud</a> · All Rights Reserved Powered By <a href="http://www.myhub.ltd" target="_blank"> myhub </a></div>-->
</div>

</body>
</html>
